package com.pakazaka.simplecrawler;

import com.pakazaka.enemies.BasicEnemy;
import com.pakazaka.testItemsSystem.Item;
import java.util.ArrayList;

/**
 *
 * @author Riseremi
 */
public class ArrayListUtils {

    public static Item getItemAt(int x, int y, Core core) {
        ArrayList<Item> list = core.getItemsOnMap();
        Item item = null;
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getBlocksX() == x && list.get(i).getBlocksY() == y) {
                item = list.get(i);
            }
        }

        return item;
    }

    public static BasicEnemy getEnemyAt(int x, int y, Core core) {
        ArrayList<BasicEnemy> list = core.getEnemies();
        BasicEnemy enemy = null;
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getAbsoluteBlocksX() == x && list.get(i).getAbsoluteBlocksY() == y) {
                enemy = list.get(i);
            }
        }
        return enemy;
    }

}
